﻿using Basic.FlowGatewayModule.Interface;
using Basic.FlowRemoteModel.Flow;
using Basic.FlowRemoteModel.Flow.Model;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FlowGatewayModule.lmpl
{
    internal class FlowService : IFlowService
    {
        public long Add ( FlowAdd data )
        {
            return new AddFlow
            {
                Datum = data
            }.Send();
        }
        public FlowChildren GetChildren ( long id )
        {
            return new GetChildrenFlow
            {
                Id = id
            }.Send();
        }
        public void Delete ( long id )
        {
            new DeleteFlow
            {
                Id = id
            }.Send();
        }
        public bool Set ( long id, FlowSet data )
        {
            return new SetFlow
            {
                Id = id,
                Datum = data
            }.Send();
        }
        public FlowDto Get ( long id )
        {
            return new GetFlow
            {
                Id = id
            }.Send();
        }
        public PagingResult<FlowData> Query ( PagingParam<FlowQueryParam> param )
        {
            return new QueryFlow
            {
                Index = param.Index,
                Query = param.Query,
                IsDesc = param.IsDesc,
                NextId = param.NextId,
                Size = param.Size,
                SortName = param.SortName
            }.Send();
        }

        public string GetName ( long id )
        {
            return new GetFlowName
            {
                Id = id
            }.Send();
        }

        public EnableFlowResult Enable ( long id )
        {
            return new EnableFlow
            {
                Id = id
            }.Send();
        }

        public bool Stop ( long id )
        {
            return new StopFlow
            {
                Id = id
            }.Send();
        }

        public EnableFlowResult Check ( long id )
        {
            return new CheckFlow
            {
                Id = id
            }.Send();
        }

        public FlowFormDto[] GetForms ( long id )
        {
            return new GetFlowFormList
            {
                Id = id
            }.Send();
        }

        public long[] GetFormId ( long id )
        {
            return new GetFlowFormId
            {
                Id = id
            }.Send();
        }

        public long Copy ( FlowCopy param, long empId )
        {
            return new CopyFlow
            {
                Arg = param,
                EmpId = empId
            }.Send();
        }
    }
}
